var p = 1
var GetList = function (that) {
  that.setData({
    hidden: false
  });
  wx.request({
    url: 'https://1234679.top.com/api/adaa/get',
    type: 'GET',
    header: { 'content-type': 'application/x-www-form-urlencoded' },  
    dataType: 'json',
    data: {
      from: 10 * (p-1),
      to: 10,
      userid: that.data.memberid,
      usertype: '1'
    },
    success: function (res) {
      
      var l = that.data.list
      for (var i = 0; i < res.data.data.length; i++) {
       
        l.push(res.data.data[i])
   
      }
      that.setData({
        list: l
      });
      p++;
      that.setData({
        hidden: true
      });
    }
  });
}
Page({
  data: {
    list: []
  },
  onLoad: function (options) {
  
    this.setData({
      memberid :options.mid
    }); 
    // 页面初始化 options为页面跳转所带来的参数  
    var that = this;
   
    wx.request({
      url: 'https://1234679.top.com/api/member/info',
      header: { 'content-type': 'application/x-www-form-urlencoded' },
      data: {
        memberid: that.data.memberid
      },
      dataType: 'json',
      method: 'GET',
      success: function (res) {
         that.setData(
          {
             info: res.data
          }
          ) 
      }
    });
    console.log(that.data)
    GetList(that)
  },
  onPullDownRefresh: function () {
    //下拉  
    console.log("下拉");
    p = 1;
    this.setData({
      list: [],
    });
    var that = this
    GetList(that)
  },
  onReachBottom: function () {
    //上拉  
    console.log("上拉")
    var that = this
    GetList(that)
  }
}) 
